define(function(require) {
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");

	var Model = function() {
		this.callParent();
		this.url = "http://yun.jiawoltd.com";
	};

	Model.prototype.modelParamsReceive = function(event) {
		var orgId;
		if (this.params && this.params.id != undefined) {
			orgId = this.params.id;
		}
		//alert(orgId);
		var jdData = this.comp("jdData");
		var ajaxCallUrl = this.url + "/mobile/getOrgByParent/" + orgId;
		$.ajax({
			cache : false,
			type : "GET",
			timeout : 10000, // 超时时间设置，单位毫秒
			url : ajaxCallUrl,
			data : {},
			async : false,
			error : function(request) {
			},
			success : function(data) {
				jdData.clear();
				jdData.loadData(data);
			}
		});

	};

	Model.prototype.media1Click = function(event) {
		justep.Shell.setIsSinglePage();
		var url = './jd.w';
		if (!event.bindingContext.$object.val('haveSubs')) {
			url = '../detail/detail.w';
		}
		justep.Shell.showPage(require.toUrl(url), {
			id : event.bindingContext.$object.val('id')
		});
	};

	return Model;
});